<%@ tag description="HTML 导航栏" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<!-- start: 属性 -->
<%@ attribute name="ctx" 	description="页面相对地址"%>
<!-- end: 属性 -->

<!-- end: 属性 -->
<div class="col-md-3 left_col menu_fixed">
	<div class="left_col scroll-view">
		<div class="navbar nav_title">
			<a href="javascript:void(0);" class="site_title"><i class="fa fa-sitemap"></i>
				<span>单位内部图书智能推荐平台</span></a>
		</div>


		<div class="clearfix"></div>

		<!-- menu profile quick info -->
		<div class="profile clearfix">
			<div class="profile_info">
						<span>你好
							<c:choose>
								<c:when test="${sessionScope.admin != null && sessionScope.admin.rank == true}">超级管理员</c:when>
								<c:when test="${sessionScope.admin != null && sessionScope.admin.rank == false}">管理员</c:when>
								<c:otherwise>${sessionScope.staff.name}</c:otherwise>
							</c:choose>
						</span>
				<h2></h2>
			</div>
		</div>
		<!-- /menu profile quick info -->

		<br/>

		<!-- sidebar menu -->
		<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
			<div class="menu_section">
				<ul class="nav side-menu">
					<c:forEach items="${sessionScope.powers}" var="power">
						<c:choose>
							<c:when test="${power.type == 1}">
								<li>
									<a><i class="fa fa-group"></i> 管理员管理 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/admin/addAdminPage">添加管理员</a></li>
										<li><a href="${ctx}/admin/adminListPage">管理员列表</a></li>
									</ul>
								</li>
							</c:when>
							<c:when test="${power.type == 7}">
								<li>
									<a><i class="fa fa-gears"></i> 角色管理 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/admin/addRolePage">添加角色</a></li>
										<li><a href="${ctx}/admin/roleListPage">角色列表</a></li>
									</ul>
								</li>
								<li>
									<a href="${ctx}/admin/countStatistic"><i class="fa fa-bar-chart"></i> 数据统计 </a>
								</li>
							</c:when>
							<c:when test="${power.type == 2}">
								<li>
									<a><i class="fa fa-book"></i> 图书管理 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/admin/addBookPage">添加图书</a></li>
										<li><a href="${ctx}/admin/bookListPage">图书列表</a></li>
										<li><a href="${ctx}/admin/evaluateListPage">评论列表</a></li>
										<li><a href="${ctx}/admin/addBookClassPage">添加图书类别</a></li>
										<li><a href="${ctx}/admin/bookClassListPage">图书类别列表</a></li>
									</ul>
								</li>
							</c:when>
							<c:when test="${power.type == 8}">
								<li>
									<a><i class="fa fa-tags"></i> 借阅管理 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/admin/borrowManagePage">借阅条目检索</a></li>
										<li><a href="${ctx}/admin/allBorrowListPage">借阅记录</a></li>
										<li><a href="${ctx}/admin/paymentManagePage">缴费条目检索</a></li>
										<li><a href="${ctx}/admin/allPaymentsListPage">缴费记录</a></li>
									</ul>
								</li>
								<li>
									<a href="${ctx}/admin/countStatistic"><i class="fa fa-bar-chart"></i> 数据统计 </a>
								</li>
							</c:when>
							<c:when test="${power.type == 3}">
								<li>
									<a><i class="fa fa-group"></i> 员工管理 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/admin/addStaffPage">添加员工</a></li>
										<li><a href="${ctx}/admin/staffListPage">员工列表</a></li>
									</ul>
								</li>
							</c:when>
							<c:when test="${power.type == 4}">
								<li>
									<a href="${ctx}/staff/bookSearchPage"><i class="fa fa-search"></i> 图书检索 </a>
								</li>
							</c:when>
							<c:when test="${power.type == 5}">
								<li>
									<a><i class="fa fa-book"></i> 我的书架 <span class="fa fa-chevron-down"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/staff/myBooksPage">当前借阅列表</a></li>
										<li><a href="${ctx}/staff/myHistoryPage">历史借阅列表</a></li>
										<li><a href="${ctx}/staff/myCollectionPage">我的收藏</a></li>
									</ul>
								</li>
								<li>
									<a href="${ctx}/staff/recommendationBooksPage"><i class="fa fa-thumbs-o-up"></i> 推荐图书 <span
											class="badge bg-orange"></span></a>
								</li>
								<li>
									<a><i class="fa fa-group"></i> 书友天地<span class="fa fa-chevron-down"></span> <span class="badge bg-orange"></span></a>
									<ul class="nav child_menu">
										<li><a href="${ctx}/staff/recommendationStaffPage">书友推荐</a></li>
										<li><a href="${ctx}/staff/myFollowFriends">我的关注</a></li>
										<li><a href="${ctx}/staff/myFollowers">我的粉丝</a></li>
									</ul>
								</li>
							</c:when>
						</c:choose>
					</c:forEach>
				</ul>
			</div>

		</div>
		<!-- /sidebar menu -->
	</div>
</div>

<!-- top navigation -->
<div class="top_nav">
	<div class="nav_menu">
		<nav>
			<div class="nav toggle">
				<a id="menu_toggle"><i class="fa fa-bars"></i></a>
			</div>

			<ul class="nav navbar-nav navbar-right">
				<li class="">
					<c:choose>
						<c:when test="${sessionScope.admin != null}">
							<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown"
							   aria-expanded="false">
								管理员
								<span class="navbar-right-n fa fa-angle-down"></span>
							</a>
							<ul class="dropdown-menu dropdown-usermenu pull-right">
								<li><a href="${ctx}/admin/updateInfoPage"><i class="fa fa-wrench pull-right"></i>设置</a></li>
								<li><a href="${ctx}/admin/updatePasswordPage"> 修改密码</a></li>
								<li><a href="${ctx}/admin/loginOut"><i class="fa fa-sign-out pull-right"></i>退出登录</a></li>
							</ul>
						</c:when>
						<c:otherwise>
							<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown"
							   aria-expanded="false">
							     ${sessionScope.staff.name}
								<span class="navbar-right-n fa fa-angle-down"></span>
							</a>
							<ul class="dropdown-menu dropdown-usermenu pull-right">
								<li><a href="${ctx}/staff/staffInfoUpdatePage"><i class="fa fa-wrench pull-right"></i>设置</a></li>
								<li><a href="${ctx}/staff/updatePasswordPage"> 修改密码</a></li>
								<li><a href="${ctx}/staff/loginOut"><i class="fa fa-sign-out pull-right"></i>退出登录</a></li>
							</ul>

						</c:otherwise>
					</c:choose>

				</li>
				<c:if test="${sessionScope.staff != null}">
					<li role="presentation" class="dropdown">
						<a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="true">
							<i class="fa fa-envelope-o"></i>
							<span class="badge bg-red">${fn:length(sessionScope.borrows)}</span>
						</a>
						<ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu">
							<c:if test="${fn:length(sessionScope.borrows) == 0}">
								<li>
									<span class="time">暂无消息</span>
								</li>
							</c:if>
							<c:forEach items="${sessionScope.borrows}" var="borrow">
								<c:if test="${borrow.state != 4 && borrow.state != 3 && borrow.endDays <= 5}">
									<li>
										<span class="time">《${borrow.book.name}》还剩${borrow.endDays}天</span>
									</li>
								</c:if>
							</c:forEach>
						</ul>
					</li>
				</c:if>
			</ul>
		</nav>
	</div>

</div>
<!-- /top navigation -->
